

package com.hazelcast.client.impl.protocol.codec.builtin;

import com.hazelcast.client.impl.protocol.ClientMessage;

import java.util.List;

import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.BYTE_SIZE_IN_BYTES;

public final class ListCNByteCodec {

    private ListCNByteCodec() {
    }

    public static void encode(ClientMessage clientMessage, Iterable<Byte> items) {
        ListCNFixedSizeCodec.encode(clientMessage, items, BYTE_SIZE_IN_BYTES, FixedSizeTypesCodec::encodeByte);
    }

    public static List<Byte> decode(ClientMessage.ForwardFrameIterator iterator) {
        return decode(iterator.next());
    }

    public static List<Byte> decode(ClientMessage.Frame frame) {
        return ListCNFixedSizeCodec.decode(frame, BYTE_SIZE_IN_BYTES, FixedSizeTypesCodec::decodeByte);
    }
}
